package uk.ac.bbk.dcs.pakdd2014;

public class Date {

	private int date;
	
	public Date(int year,int month){
		date=year*12+(month-1);
	}
	public Date clone()
	{
		return new Date(getYear(), getMonth());
	}
	
	public int getYear(){
		return date/12;
	}
	public int getMonth(){
		return (date%12)+1;
	}
	public int differenceDate(Date d){
		return date-d.date;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + date;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Date other = (Date) obj;
		if (date != other.date)
			return false;
		return true;
	}
	
	public void dec() {
		date--;
	}
	@Override
	public String toString() {
		return "Date [year=" + date/12 + ", month=" + (date%12+1) + "]";
	}
	
}
